/*
  Copyright (C) 2006 by Lukas Loehrer

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA

  Author: Massimiliano Mirra, <bard [at] hyperstruct [dot] net>
*/

// A simple service for testing mozremote
var BaseService = module.require("class", "base_service");

function TestService(name, remote) {
	BaseService.call(this, name);
	this._remote = remote;
}

// Returns i incremented by amount; amout is optional and defaults to 1
function increment(i, amount) {
	if (typeof(amount)  == "undefined") {
		amount = 1;
	}
	return i + amount;
}

// Echos back whatever arguments are passed
function echoArgs() {
	var result = [];
	for (var i = 0; i < arguments.length; i++) {
		result.push(arguments[i]);
	}
	return result;
}

function getSimpleObject() {
	return { Hello: "World", foo: "bar", _a: 0, _b: 0 };
}

// Throws and exception
function fails() {
	var foo = not_there.property;
}

TestService.prototype = new BaseService();
TestService.prototype.increment = increment;
TestService.prototype.echoArgs = echoArgs;
TestService.prototype.fails = fails;
TestService.prototype.getSimpleObject = getSimpleObject;

				   
